<?php
/******************************************************
v4 - Management Framework
Copyright (C) 2008  Gary Taylor, gMerc Incorporation
http://www.gmerc.com/v4/

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

gary@gmerc.com
******************************************************/
class mysqldumptofile {
  function loaddata() {
    global $masterclass;


  return;
  }


  function display() {
    global $masterclass;

    if ($masterclass->mainconfig['default_database']!='' && $masterclass->mainconfig['default_database']!='information_schema' && $masterclass->mainconfig['default_database']!='mysql') {
      $command = "/usr/local/mysql/bin/mysqldump --skip-opt --compact --add-drop-table --add-locks --create-options --disable-keys --complete-insert --lock-tables --quick --set-charset --host=localhost --user='smilebackup' --password='h6yyer54' ".$masterclass->mainconfig['default_database'];
      $dump=shell_exec($command);
    } else {
      $dump='Nice Try '.$masterclass->mainconfig['default_database'];
    }
    $sqlfilename='mysqldump_'.date("m_d_Y-H_i").'.sql';
    header("Content-Type: text/plain");
    header('Content-Disposition: inline; filename="'.$sqlfilename.'"');
    header("Content-Transfer-Encoding: Binary");
    header("Content-length: ".strlen($dump));
    header('Content-Disposition: attachment; filename="'.$sqlfilename.'"');
    echo $dump;
    
  return;
  }
}
?>